package com.ddstation.schedule;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 心跳监视
 * @author zhangdifeng
 * @date 2019年6月26日
 */
@Component
public class HeartKeeperTask {
	
	/**
     * 注解中填入cron表达式
     * 下述是每5分钟执行
     */
    @Scheduled(cron = "0 0/5 * * * ? ")
    public void execute() {
    	logger.info("心跳监视开始.........");
        /*
        	执行所要完成的业务
         */
//    	MaSystemSettingEntity systemSetting = SystemProperties.getSystemSetting();
//    	Map<String, String> params = new HashMap<String, String>();
//		params.put("appid", systemSetting.getAppid());
//		JSONObject json = wnBridgeService.requestPost(systemSetting.getWeknowDomain() + "/wncloud_heartkeeper.do", params);
//		if (json != null && "0".equals(json.getString("errcode"))) {
//			if (json.containsKey("commandid")) {
//				String commandid = json.getString("commandid");
//				if (StringUtils.isNotBlank(commandid)) {
//					commandService.exec(commandid);
//				}
//			}
//		}
    	logger.info("心跳监视结束.........");
    }
    
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
//    private @Inject CommandService commandService = null;
}
